package cc.realxyq.kewei.search.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * 一句话描述该类的功能
 *
 * @author : Hankewei
 * @version : v1.0
 * @createTime : [2021/6/23 2:45]
 */
@Configuration
public class ElasticSearchConfig {
    //@Bean
    //RestHighLevelClient restHighLevelClient(){
        //RestHighLevelClient restHighLevelClient = new RestHighLevelClient(RestClient.builder(
        //        new HttpHost("192.168.162.100", 9200, "http")));
        //return restHighLevelClient;

        @Bean
        public RestHighLevelClient esRestClient(){
            RestHighLevelClient client = new RestHighLevelClient(
                    RestClient.builder(new HttpHost("192.168.162.100", 9200, "http")));
            return  client;
        }
    }
